import {
	$get,
	$post,
	$put
} from '@/utils/request'
import axios from '@/utils/axios/index';

/**
 * 登录
 * @param {Object} params 
 */
export const login = (params) => axios.post('/merchant/api/logins', params, {
	carryToken: false
})

/**
 * 登出
 * @param {String} token 
 */
export const logout = (params) => $post(`/merchant/api/logins/logout`, params)

/**
 * 注册
 * @param {Object} params 
 */
export const register = (params) => axios.post('/merchant/api/logins/register', params, {
	carryToken: false
})
/**
 * 修改密码
 * @param {Object} config 
 */
export const modifyPassword = (params) => $post(`/merchant/api/users/edit/password`, params)
/**
 * 忘记密码
 * @param {Object} config 
 */
export const retrievePassword = (params) => $post(`/merchant/api/logins/retrieve`, params)
/**
 * 实名认证-提交表单
 * @param {Object} params
 */
export const updateAgentSettlementInfo = (params) => $post(`/merchant/api/users/authorization`, params)
/**
 * 用户详情
 * @param {Object} params
 */
export const queryUserDetail = (id) => $get(`/merchant/api/users/${id}`);
/**
 * 我的用户认证信息
 * @param {Object} params
 */
export const queryAthorization = (id) => $get(`/merchant/api/users/authorization/${id}`);
/**
 * 新增银行卡
 * @param {Object} params
 */
export const bindBankCard = (params) => $post(`/merchant/api/users/bank-card`, params);
/**
 * 银行卡列表
 * @param {Object} params
 */
export const bankCardList = (userId, bankType) => $get(`/merchant/api/users/bank-card/${userId}/${bankType}/list`);
/**
 * 创建商户
 * @param {Object} params
 */
export const createMerchant = (params) => $post(`/merchant/api/merchants`, params);
/**
 * 获取商户详情
 * @param {Object} params
 */
export const queryMerchants = (params) => $get(`/merchant/api/merchants/jzg/${params}`);
/**
 * 根据sn号判断是否存在商户
 *  @param {Object} params
 */
export const queryExistence = (params) => $get(`/merchant/api/merchants/device-rate/merchant/${params}`);
/**
 * 变更通道
 *  @param {Object} params
 */
export const changeChannel = (params) => $post(`/merchant/api/merchants/jzg/channel`, params);
/**
 * 通道实名
 *  @param {Object} params
 */
export const merchantOcr = (params) => $post(`/merchant/api/merchants/ocr`, params);

/**
 * 绑定终端
 *  @param {Object} params
 */
export const bindSn = (params) => $post(`/merchant/api/merchants/bindSn`, params);

/**
 * 店铺列表
 *  @param {Object} params
 */
export const shopLists = (id, sn) => $get(`/merchant/api/merchants/lsMerchant/${id}/${sn}`);
/**
 * 店铺换绑
 *  @param {Object} params
 */
export const merchantschangeBindSn = (params) => $post(`/merchant/api/merchants/changeBindSn`, params);
/**
 * 银行卡解绑
 *  @param {Object} params
 */
export const unbindBank = (params) => $post(`/merchant/api/users/unbound-bank-card`, params);

/**
 * 到账修改
 *  @param {Object} params
 */
export const withdrawSwitch = (params) => $post(`/merchant/api/merchants/withdrawSwitch`, params);
/**
 * 到账
 *  @param {Object} params
 */
export const withdraw = (params) => $post(`/merchant/api/merchants/withdraw`,params);

/**
 * 
 *  @param {Object} params
 */
export const getTerminalList = (merchantNo) => $get(`/merchant/api/Termina/list/${merchantNo}`);

/**
 * 
 *  @param {Object} params
 */
export const withdrawSms = (params) => $post(`/merchant/api/merchants/withdrawSwitchSms`, params);

/**
 * 
 *  @param {Object} params
 */
export const withdrawSwitchQuery = (params) => $post(`/merchant/api/merchants/withdrawSwitchQuery`, params);
